from django.conf.urls import url, include
from django.contrib.auth.models import User
from rest_framework import routers, serializers, viewsets
from rest_framework.schemas import get_schema_view
from rest_framework_swagger.renderers import SwaggerUIRenderer, OpenAPIRenderer
from rest_framework import mixins
from rest_framework import generics
from django.contrib import admin
from django.conf import settings

from User.viewsets import UserViewSet
from Group.viewsets import GroupViewSet
from DatebaseInfo.viewsets import FundDbInfoViewSet
# Routers provide an easy way of automatically determining the URL conf.
router = routers.DefaultRouter()
router.register(r'users', UserViewSet, base_name='users')
router.register(r'groups', GroupViewSet, base_name='groups')
router.register(r'DatebaseInfo', FundDbInfoViewSet, base_name='DatebaseInfo')
# Create our schema's view w/ the get_schema_view() helper method. Pass in the proper Renderers for swagger
schema_view = get_schema_view(title='Users API', renderer_classes=[OpenAPIRenderer, SwaggerUIRenderer])

# Wire up our API using automatic URL routing.
# Additionally, we include login URLs for the browsable API.
urlpatterns = [
    url(r'^'+settings.APPNAME+'/docs/', schema_view, name="docs"),
    url(r'^'+settings.APPNAME+'/api/', include(router.urls)),
    url(r'^'+settings.APPNAME+'/api-auth/', include('rest_framework.urls', namespace='rest_framework')),
    url(r'^'+settings.APPNAME+'/admin/', admin.site.urls),
]
